/*
 * TableModel.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.table;

import com.cute4j.swing.events.TableModelListener;

/**
 * Table Model Interface.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public interface TableModel {

  /**
   * Returns the number of rows.
   *
   * @return the number of rows
   */
  public int getRowCount();

  /**
   * Returns the number of columns.
   *
   * @return the number of columns
   */
  public int getColumnCount();

  /**
   * Returns the name of the specified column.
   *
   * @param columnIndex the column index
   *
   * @return the name of the specified column
   */
  public String getColumnName(int columnIndex);

  /**
   * Returns the class of the specified column.
   *
   * @param columnIndex the column index
   *
   * @return the class of the specified column
   */
  public Class getColumnClass(int columnIndex);

  /**
   * Returns <tt>true</tt> if the cell is editable.
   *
   * @param rowIndex the row index
   * @param columnIndex the column index
   *
   * @return <tt>true</tt> if the cell is editable
   */
  public boolean isCellEditable(int rowIndex, int columnIndex);

  /**
   * Returns the value of the specified cell.
   *
   * @param rowIndex the row index
   * @param columnIndex the column index
   *
   * @return the value of the specified cell
   */
  public Object getValueAt(int rowIndex, int columnIndex);

  /**
   * Sets the value for the specified cell.
   *
   * @param value the value
   * @param rowIndex the row index
   * @param columnIndex the column index
   */
  public void setValueAt(Object value, int rowIndex, int columnIndex);

  /**
   * Adds listener.
   *
   * @param listener the listener
   */
  public void addTableModelListener(TableModelListener listener);

  /**
   * Removes a listener.
   *
   * @param listener the listener
   */
  public void removeTableModelListener(TableModelListener listener);

}
